export const computedStageId = gradeId => {
  let stageId = 0
  // 😊
  if (gradeId === 1018) {
    stageId = 1008
  } else if (gradeId <= 6) {
    stageId = 1
  } else if (gradeId <= 9) {
    stageId = 2
  } else {
    stageId = 3
  }
  return stageId
}

// 格式化数字，0.6 => 60   0.3333 => 33.3
export function formatNum(num, index = 1, radix = 100) {
  const formatRoundNum = (numF, preF) =>
    (Math.floor(numF * Math.pow(10, preF)) / Math.pow(10, preF)).toFixed(preF)
  num = parseFloat((num * radix).toPrecision(12))
  return String(num).indexOf('.') >= 0 ? formatRoundNum(num, index) : num
}
